<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>个人信息</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('<spring:message code="common.subbmiting"/>');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
    <style>
        .form-horizontal .control-label{
            float: left;
            font-size: 14px;
        }
        .form-horizontal .controls{
            width:160px;
            margin-left: 10px;
            overflow-x: hidden;
            float: left;
            font-size: 14px;
        }
        .controls .lbl {
            display: block;
            padding-top: 3px;
            /* margin-bottom: 0px; */
            vertical-align: middle;
            font-size: 14px;
        }
    </style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/user/info?id=${user.id}"><spring:message code="user.detail"/></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="user" action="${ctx}/sys/user/info" method="post" class="form-horizontal">
		<sys:message content="${message}"/>
        <div class="control-group">
            <label class="control-label"><spring:message code="common.account"/>:</label>
            <div class="controls">
                <label class="lbl">${user.loginName}</label>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><spring:message code="common.name"/>:</label>
            <div class="controls">
                <label class="lbl">${user.name}</label>
            </div>
			<label class="control-label"><spring:message code="common.company"/>:</label>
			<div class="controls">
				<label class="lbl">${user.company.name}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label"><spring:message code="common.phone_number"/>:</label>
			<div class="controls">
                <label class="lbl">${user.mobile}</label>
			</div>
			 <c:if test="${user.userType == '4' or user.userType == '3'}">
            <label class="control-label"><spring:message code="manager.region.last"/>:</label>
            <div class="controls">
                <label class="lbl">${user.areaBy.name}</label>
            </div>
            </c:if>
        </div>
        <div class="control-group">
            <label class="control-label"><spring:message code="common.expiration"/>:</label>
            <div class="controls">
                <label class="lbl"><fmt:formatDate value="${user.avaliDate}" pattern="yyyy-MM-dd"/></label>
            </div>
          <c:if test="${user.userType == '4'}">
            <label class="control-label"><spring:message code="manager.group.last"/>:</label>
            <div class="controls">
                <label class="lbl">${user.maintainBy.name}</label>
                
            </div>
             <label class="control-label"><spring:message code="manager.group.last.phone"/>:</label>
            <div class="controls">
                <label class="lbl">${user.maintainBy.mobile}</label>
                
            </div>
            </c:if>
        </div>
		<div class="control-group">
			<label class="control-label"><spring:message code='common.remarks'/>:</label>
			<div class="controls">
                <label class="lbl">${user.remarks}</label>
			</div>
            <label class="control-label"><spring:message code='common.applicant'/>:</label>
            <div class="controls">
                <label class="lbl">${user.createBy.name}</label>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><spring:message code="common.authority"/>:</label>
            <div class="controls">
                <label class="lbl">
                <c:if test="${language == 'zh'}">
                ${user.roleNames}
                </c:if>
                <c:if test="${language == 'en'}">
                ${user.role.enname}
                </c:if></label>
            </div>
            <label class="control-label"><spring:message code='common.approver'/>:</label>
            <div class="controls">
                <label class="lbl">${user.checkBy.name}</label>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label"><spring:message code="common.group"/>:</label>
            <div class="controls">
                <label class="lbl">${user.office.name}</label>
            </div>
            <label class="control-label"><spring:message code='audit.state'/>:</label>
            <div class="controls">
                <label class="lbl">
                    <c:if test="${user.delFlag==0}">
                        <spring:message code="approved"/>
                    </c:if>
                    <c:if test="${user.delFlag==1}">
                        <spring:message code='common.delete'/>
                    </c:if>
                    <c:if test="${user.delFlag==2}">
                        <spring:message code='inapproval'/>
                    </c:if>
                    <c:if test="${user.delFlag==3}">
                         <spring:message code="rejected"/>
                    </c:if>
                </label>
            </div>
        </div>
        <c:if test="${show == 'yes' }">
		<div class="form-actions" style="padding-left: 80px">
            <c:if test="${!isSelf}">
                <shiro:hasPermission name="sys:user:edit">
                    <a href="${ctx}/sys/user/edit?id=${user.id}" class="btn btn-primary"><spring:message code='common.edit'/></a>
                    <a href="${ctx}/sys/user/delete?id=${user.id}" onclick="return confirmx('<spring:message code='tips.deluser' />', this.href)"
                       class="btn btn-danger"><spring:message code='common.delete'/></a><br><br>
                    <a href="${ctx}/sys/user/resetPassword?id=${user.id}" onclick="return confirmx('<spring:message code='tips.resetpassword' />', this.href)"
                       class="btn"><spring:message code='common.reset.password'/></a>
                </shiro:hasPermission>

            </c:if>
        <c:if test="${user.role.dataScope !=4}">
            <a href="${ctx}/sys/user/sublist?userId=${user.id}" class="btn" type="button" ><spring:message code='common.sub.users'/></a>
            <a href="${ctx}/sys/user/controlequipmentlist?userId=${user.id}" class="btn" type="button" ><spring:message code='common.sub.devices'/></a>
            <br>
            <br>
        </c:if>
            <c:if test="${user.delFlag != 0}">
                <c:if test="${user.delFlag == 2}">
                    <shiro:hasPermission name="sys:user:check">
                        <a href="${ctx}/sys/user/check?userId=${user.id}&delFlag=0" onclick="return confirmx('<spring:message code='tips.passuser' />', this.href)"
                           class="btn btn-success">通 过</a>
                        <a href="${ctx}/sys/user/check?userId=${user.id}&delFlag=3" onclick="return confirmx('<spring:message code='tips.rejectuser' />', this.href)"
                           class="btn btn-inverse">驳 回</a>
                    </shiro:hasPermission>
                </c:if>
                <c:if test="${user.delFlag==2}">
                    <shiro:lacksPermission name="sys:user:check">
                        <shiro:hasPermission name="sys:user:edit">
                            <a href="${ctx}/sys/user/recheck?userId=${row.id}" onclick="return confirmx('<spring:message code='tips.reupexamine' />', this.href)"
                               class="btn btn-inverse"><spring:message code='common.resubmit'/></a>
                        </shiro:hasPermission>
                    </shiro:lacksPermission>
                </c:if>
            </c:if>
        </div>
        </c:if>
	</form:form>
</body>
</html>